home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / kernel / xoper13.2 < prev    next >
Internet Message Format  |  1989-03-15  |  63KB

  1. Path: xanth!ukma!mailrus!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i053:  xoper - system operations control v1.3, Part02/02
  5. Message-ID: <12233@swan.ulowell.edu>
  6. Date: 15 Mar 89 17:51:43 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 2149
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: G35@DHDURZ1.BITNET (Guenther Werner)
  12. Posting-number: Volume 89, Issue 53
  13. Archive-name: kernel/xoper13.2
  14.  
  15. #    This is a shell archive.
  16. #    Remove everything above and including the cut line.
  17. #    Then run the rest of the file through sh.
  18. #----cut here-----cut here-----cut here-----cut here----#
  19. #!/bin/sh
  20. # shar:    Shell Archiver
  21. #    Run the following text with /bin/sh to create:
  22. #    Xoper.asm2
  23. #    Xoper.doc
  24. # This archive created: Wed Mar 15 12:40:15 1989
  25. cat << \SHAR_EOF > Xoper.asm2
  26.             bsr     putnam
  27.             bra     hu5
  28. hu3         move.l  172(a4),d1
  29.             bne.s   hu4
  30. noprogload  move.l  #notload,d0
  31.             bra     putnam
  32. hu4         move.l  #cliprocs,d0
  33.             bsr     putnam
  34.             lsl.l   #2,d1
  35.             move.l  d1,a4
  36.             move.l  60(a4),d1
  37.             beq.s   noprogload
  38.             move.l  #procloaded,d0
  39.             bsr     putstr
  40.             move.l  16(a4),d0
  41.             bsr     putbcpl
  42.             bsr     newline
  43. hu5         lea     hunkheader(PC),a0
  44.             bsr     puthead
  45. hu6         move.l  d1,d0
  46.             bsr     hexa
  47.             lsl.l   #2,d1
  48.             move.l  d1,a4
  49.             move.l  d1,d0
  50.             addq.l  #4,d0
  51.             bsr     hexa
  52.             move.l  -4(a4),d0
  53.             bsr     hexa
  54.             bsr     newline
  55.             move.l  0(a4),d1
  56.             bne.s   hu6
  57.             rts
  58. ;change the priority of a node
  59. pri         bsr     getnum
  60.             tst.b   d7
  61.             beq     syntax
  62.             move.b  d2,newpri
  63.             bsr     nodenam2
  64.             moveq.l #5,d7
  65.             lea     DevNode(PC),a4
  66.             bsr     findnam
  67.             tst.b   d7
  68.             beq.s   pi1
  69.             move.l  d0,a1
  70.             move.b  newpri,9(a1)
  71.             cmp.l   #SemNode,a4
  72.             ble.s   pi2
  73.             move.l  #listerr,d0
  74.             bra     putnam
  75. pi2         CALL    Forbid,_SysBase(PC)
  76.             CALL    Remove,_SysBase(PC)
  77.             move.l  d0,a1
  78.             move.l  a4,a0
  79.             move.l  0(a0),d6
  80.             lea     0(a6,d6),a0
  81.             CALL    Enqueue,_SysBase(PC)
  82.             CALL    Permit,_SysBase(PC)
  83. pi1         rts
  84. ;set all break signals of a task
  85. break       move.l  #$f000,d0
  86.             bra     setthem
  87.  
  88. signal      bsr     readhex
  89.             tst.b   d7
  90.             beq     syntax
  91. setthem     move.l  d0,savedat
  92.             bsr     nodenam
  93.             moveq.l #2,d7
  94.             lea     TReNode(PC),a4
  95.             bsr     findnam
  96.             tst.b   d7
  97.             beq.s   pi1
  98.             move.l  d0,a1
  99.             move.l  savedat,d0
  100.             and.l   18(a1),d0
  101.             CALL    Signal,_SysBase(PC)
  102.             rts
  103.  
  104. hide        cmp.b   #10,0(a0)
  105.             bne.s   hid5
  106.             bra     syntax
  107. hid5        lea     hidestart(PC),a2
  108.             move.l  a2,d3
  109. hid0        tst.l   0(a2)
  110.             beq.s   hid1
  111.             move.l  0(a2),a2
  112.             lea     4(a2),a1
  113.             bsr     strcmp
  114.             tst     d0
  115.             beq.s   hid2
  116.             move.l  a2,d3
  117.             bra.s   hid0
  118. hid1        move.l  a0,a4
  119.             bsr     strlen2
  120.             addq    #5,d0
  121.             move.l  #65536,d1
  122.             CALL    AllocMem,_SysBase(PC)
  123.             tst.l   d0
  124.             beq.s   hid4
  125.             move.l  d0,a1
  126.             move.l  d0,0(a2)
  127.             lea     4(a1),a1
  128. hid3        cmp.b   #10,0(a4)
  129.             beq.s   hid4
  130.             move.b  (a4)+,(a1)+
  131.             bra.s   hid3
  132. hid4        rts
  133. hid2        move.l  d3,a3
  134.             move.l  0(a2),0(a3)
  135. freehidden  lea     4(a2),a0
  136.             bsr     strlen
  137.             addq    #5,d0
  138.             move.l  a2,a1
  139.             CALL    FreeMem,_SysBase(PC)
  140.             rts
  141.  
  142. freehidmem  move.l  hidestart(PC),a4
  143. fhm0        move.l  a4,d0
  144.             beq.s   fhm1
  145.             move.l  a4,a2
  146.             move.l  0(a2),a4
  147.             bsr     freehidden
  148.             bra     fhm0
  149. fhm1        rts
  150.  
  151. ;'flushlibs'
  152. flush       move.l  #$ffffff,d0
  153.             clr.l   d1
  154.             CALL    AllocMem,_SysBase(PC)
  155.             rts
  156.  
  157. ;display library->lib_IDString
  158. info        bsr     nodenam2
  159.             moveq.l #2,d7
  160.             lea     DevNode(PC),a4
  161.             bsr     findnam
  162.             tst.b   d7
  163.             beq.s   fhm1
  164.             move.l  d0,a0
  165.             move.l  24(a0),d0
  166.             beq.s   if1
  167.             move.l  d0,d1
  168.             andi.l  #$ff000000,d1
  169.             bne.s   if1
  170.             bra     putnam
  171. if1         move.l  #noinfo,d0
  172.             bsr     putstr
  173.             move.l  a5,d0
  174.             bra     putnam
  175.  
  176. capture     move.l  _SysBase(PC),a1
  177.             lea     42(a1),a0
  178.             moveq   #2,d6
  179.             lea     coldtxt,a4
  180. cap0        move.l  a4,d0
  181.             bsr     putstr
  182.             move.l  0(a0),d0
  183.             bne.s   cap1
  184.             move.l  #unset,d0
  185.             bsr     putstr
  186.             bra     cap2
  187. cap1        bsr     hexa
  188. cap2        bsr     newline
  189.             lea     15(a4),a4
  190.             lea     4(a0),a0
  191.             dbf     d6,cap0
  192.  
  193.             move.l  #kicktxt,d0
  194.             bsr     putstr
  195.             move.l  546(a1),a0
  196.             cmpa.l  #0,a0
  197.             bne.s   kickm3
  198.             move.l  #unset,d0
  199.             bra     putnam
  200. kickm3      move.l  a0,-(a7)
  201.             bsr     newline
  202.             lea     kickhead(PC),a0
  203.             bsr     puthead
  204.             move.l  (a7)+,a0
  205. kickm0      cmpa.l  #0,a0
  206.             bne.s   kickm1
  207.             rts
  208. kickm1      move.w  14(a0),d6
  209.             subq    #1,d6
  210.             lea     16(a0),a2
  211. kickm2      move.l  0(a2),d0
  212.             bsr     hexa
  213.             move.l  0(a2),d0
  214.             move.l  4(a2),d4
  215.             add.l   d4,d0
  216.             bsr     hexa
  217.             move.l  d4,d0
  218.             clr.b   d3
  219.             bsr     longdec
  220.             bsr     newline
  221.             lea     8(a2),a2
  222.             dbf     d6,kickm2
  223.             move.l  0(a0),a0
  224.             bra     kickm0
  225.             rts
  226.  
  227. clrcold     move.l  _SysBase,a0
  228.             clr.l   42(a0)
  229.             bra.s   chksum
  230. clrcool     move.l  _SysBase,a0
  231.             clr.l   46(a0)
  232.             bra.s   chksum
  233. clrwarm     move.l  _SysBase,a0
  234.             clr.l   50(a0)
  235.  
  236. chksum      lea     34(a0),a1
  237.             move    #22,d0
  238. addchk      add     (a1)+,d1
  239.             dbf     d0,addchk
  240.             not     d1
  241.             move.w  d1,82(a0)
  242.             rts
  243.  
  244. setwindow   tst.b   fromfile
  245.             bne.s   wiw1
  246.             move.l  #wiwerr,d0
  247.             bra     putnam
  248. wiw1        lea     window_l(PC),a3
  249.             moveq   #3,d5
  250. wiw0        bsr     getnum
  251.             tst     d7
  252.             beq.s   wiw2
  253.             move.w  d2,0(a3)
  254.             lea     2(a3),a3
  255.             dbf     d5,wiw0
  256. wiw2        rts
  257.  
  258. ;display ExecBase->LastAlert
  259. lastalert   movem.l $100,d1-d2
  260.             tst.l   d1
  261.             bne.s   al1
  262.             move.l  _SysBase(PC),a0
  263.             movem.l 514(a0),d1-d2
  264.             bra.s   al1
  265. alert       movem.l $100,d1-d2
  266.             cmp.l   #'HELP',0
  267.             beq.s   al1
  268.             move.l  #noguru,d0
  269.             bra     putnam
  270.  
  271. al1         move.l  #gurutxt,d0
  272.             bsr     putstr
  273.             move.l  d1,d0
  274.             bsr     hex8
  275.             lea     out,a0
  276.             move.l  ptr(PC),d0
  277.             move.b  #'.',-1(a0,d0)
  278.             move.l  d2,d0
  279.             bsr     hex8
  280.             bra     newline
  281.  
  282. ;toggle '<MORE>' on/off
  283. moretst     tst.b   fromfile
  284.             beq.s   mtst1
  285.             bchg    #0,morefl2
  286.             rts
  287. mtst1       bchg    #0,morefl
  288.             rts
  289. ;toggle CPUSE task list
  290. usage       bchg    #0,usageflag
  291.             rts
  292.  
  293. ;toggle task-header display on/off
  294. nohead      bchg    #0,headon
  295.             rts
  296.  
  297. ;toggle hide entries on/off
  298. hidden      bchg    #0,hideon
  299.             rts
  300.  
  301. ;toggle sort on/off
  302. sort       bchg    #0,sorton
  303.             rts
  304.  
  305. ;toggle task-ports display on/off
  306. taskports   bchg    #0,tports
  307. clo1        rts
  308.  
  309. ;Open a library
  310. openlib     bsr     nodenam2
  311.             move.l  a5,a1
  312.             clr.l   d0
  313.             CALL    OpenLibrary,_SysBase(PC)
  314.             tst.l   d0
  315.             beq     fn5
  316. opli1       bsr     clearscr
  317.             bra     showlibs
  318.  
  319. ;close it
  320. closelib    bsr     nodenam2
  321.             clr.l   d7
  322.             lea     LibNode(PC),a4
  323.             bsr     findnam
  324.             tst.b   d7
  325.             beq.s   clo1
  326.             move.l  d0,a1
  327.             CALL    CloseLibrary,_SysBase(PC)
  328.             bra     opli1
  329.  
  330. ;end Xoper but stay in background
  331. hold        lea     4(a7),a7
  332.             bra.s   instback
  333. quithold    lea     in,a0
  334.             lea     dummy,a1
  335. qh1         move.b  (a1)+,d0
  336.             move.b  d0,(a0)+
  337.             cmp.b   #10,d0
  338.             bne.s   qh1
  339.  
  340. instback    tst.b   background
  341.             bne.s   cleanit
  342.             move.b  #1,background
  343.             bsr     installh
  344. cleanit     tst.l   fileptr
  345.             beq.s   ib1
  346.             move.l  window(PC),a0
  347.             move.w  4(a0),window_l
  348.             move.w  6(a0),window_t
  349.             move.w  8(a0),window_w
  350.             move.w  10(a0),window_h
  351.             move.l  fileptr(PC),d1
  352.             CALL    Close,dosbase(PC)
  353.             clr.l   fileptr
  354. ib1         clr.b   running
  355.             move.l  mysignal(PC),d0
  356.             CALL    Wait,_SysBase(PC)
  357.             move.b  #1,running
  358.             bra     restart
  359.  
  360. ;fill all unused memory-chunks with a longword
  361. clear       clr.l   d0
  362.             cmp.b   #10,0(a0)
  363.             beq.s   clr5
  364.             bsr     readhex
  365.             tst.b   d7
  366.             beq     syntax
  367. clr5        move.l  _SysBase(PC),a0
  368.             clr.l   parmtxt
  369.             lea     322(a0),a0
  370.             move.w  #$4000,$dff09a
  371. clr1        move.l  0(a0),a0
  372.             tst.l   0(a0)
  373.             beq.s   clr4
  374.             move.l  16(a0),a1
  375. clr2        tst.l   0(a1)
  376.             beq.s   clr1
  377.             add.l   #1,parmtxt
  378.             move.l  4(a1),d1
  379.             sub.l   #8,d1
  380.             beq.s   clr31
  381.             lsr.l   #2,d1
  382.             subq.l  #1,d1
  383.             lea     8(a1),a2
  384. clr3        move.l  d0,(a2)+
  385.             dbf     d1,clr3
  386. clr31       move.l  0(a1),a1
  387.             bra.s   clr2
  388. clr4        move.w  #-$4000,$dff09a
  389.             move.l  parmtxt(PC),d0
  390.             bsr     bytedec
  391.             move.l  #clrtxt,d0
  392.             bra     putnam
  393.  
  394. ;find a named node
  395. ;d7 = number of lists to search through
  396. ;a4 = pointer to the first entry in the
  397. ;     list-offset-table
  398. ;a5 = pointer to name
  399. ;returns:
  400. ;d7 = TRUE/FALSE 1/0
  401. ;d0 = node
  402.  
  403. findnam     cmp.b   #'$',0(a5)
  404.             bne.s   fn2
  405.             move.l  d7,d2
  406.             move.l  a5,a0
  407.             bsr     readhex
  408.             tst.b   d7
  409.             beq.s   fn6
  410.             move.l  d2,d7
  411.             bsr     tstnode
  412.             tst.l   d5
  413.             bne.s   fn3
  414.             bra     fn5
  415. fn6         move.l  d2,d7
  416. fn2         move.l  _SysBase(PC),a0
  417.             adda.l  0(a4),a0
  418.             move.l  a5,a1
  419. fn4         CALL    FindName,_SysBase(PC)
  420.             tst.l   d0
  421.             bne.s   fn1
  422.             lea     4(a4),a4
  423.             dbf     d7,fn2
  424. fn5         move.l  #namerr,d0
  425.             bsr     putstr
  426.             move.l  a5,d0
  427.             bsr     putnam
  428.             clr.b   d7
  429.             rts
  430. fn1         move.b  procnum(PC),d2
  431.             beq.s   fn3
  432.             move.l  d0,a0
  433.             cmp.b   143(a0),d2
  434.             bne.s   fn4
  435. fn3         moveq.l #1,d7
  436.             rts
  437.  
  438. ;list-offset-table
  439. TRuNode     dc.l    276
  440. TReNode     dc.l    406
  441. TWaNode     dc.l    420
  442. DevNode     dc.l    350
  443. LibNode     dc.l    378
  444. ResNode     dc.l    336
  445. MemNode     dc.l    322
  446. PorNode     dc.l    392
  447. SemNode     dc.l    532
  448.  
  449. ;Node has been entered in hex. Check if this node exsists
  450. tstnode     tst.b   fromfile
  451.             bne.s   illegalhex
  452.             move.l  d0,d1
  453.             and.l   #$ff000001,d1
  454.             beq.s   inrange
  455.             move.l  #adrerr,d0
  456.             bsr     putnam
  457. illegalhex  clr.l   d5
  458.             rts
  459. inrange     movem.l d7/a4,-(a7)
  460.             cmp.l   #TRuNode,a4
  461.             bne.s   inrange1
  462.             move.l  _SysBase(PC),a0
  463.             cmp.l   276(a0),d0
  464.             beq.s   nodefound
  465.             subq    #1,d7
  466.             lea     4(a4),a4
  467. inrange1    move.w  #$4000,$dff09a
  468. getlist     move.l  _SysBase(PC),a0
  469.             add.l   0(a4),a0
  470. nxtnode     tst.l   0(a0)
  471.             beq.s   nxtlist
  472.             cmp.l   a0,d0
  473.             beq.s   nodefound
  474.             move.l  0(a0),a0
  475.             bra.s   nxtnode
  476. nxtlist     lea     4(a4),a4
  477.             dbf     d7,getlist
  478.             move.w  #-$4000,$dff09a
  479.             movem.l d0/d7/a4,-(a7)
  480.             move.l  #noderr,d0
  481.             bsr     putnam
  482.             bsr     readline
  483.             movem.l (a7)+,d0/d7/a4
  484.             or.b    #32,dummy
  485.             cmp.b   #'y',dummy
  486.             beq.s   nodefound1
  487.             clr.l   d5
  488.             movem.l (a7)+,d7/a4
  489.             rts
  490. nodefound   move.w  #-$4000,$dff09a
  491. nodefound1  move.b  #1,d5
  492. etst        movem.l (a7)+,d7/a0
  493.             rts
  494.  
  495. ;clear our window
  496. clearscr    tst.b   fromfile
  497.             bne.s   cscr1
  498.             move.l  #cls,d2
  499.             move.l  fileptr,d1
  500.             moveq.l #6,d3
  501.             CALL    Write,dosbase(PC)
  502. cscr1       rts
  503. ;allocate FileInfoBlock
  504. allocfinfo  move.l  #260,d0
  505.             clr.l   d1
  506.             CALL    AllocMem,_SysBase(PC)
  507.             move.l  d0,finfoptr
  508.             rts
  509.  
  510. ;free FileInfoBlock
  511. freefinfo   move.l  #260,d0
  512.             move.l  finfoptr,a1
  513.             CALL    FreeMem,_SysBase(PC)
  514.             rts
  515.  
  516. ;Examine ,d0=Lock
  517. getfinfo    move.l  d0,d1
  518.             move.l  finfoptr,d2
  519.             CALL    Examine,dosbase(PC)
  520.             rts
  521.  
  522. ;construct a Pathname from a lock
  523. ;d0=Lock ,resulting string is written to window
  524. getpath     movem.l d1-d7/a0-a6,-(a7)
  525.             move.l  d0,d1
  526.             CALL    DupLock,dosbase(PC)
  527.             lea     out,a4
  528.             clr.b   -(a4)
  529. gp0         tst.l   d0
  530.             beq.s   putall
  531.             move.l  d0,-(a7)
  532.             bsr     getfinfo
  533.             move.l  finfoptr,a0
  534.             move.l  4(a0),d4
  535.             lea     8(a0),a0
  536.             bsr     strlen
  537.             lea     -1(a4),a5
  538.             tst.l   d4
  539.             bmi.s   nodir
  540.             move.b  #'/',-(a4)
  541. nodir       subq    #1,d0
  542.             bmi.s   nofnam
  543. gp1         move.b  0(a0,d0),-(a4)
  544.             dbf     d0,gp1
  545. nofnam      move.l  0(a7),d1
  546.             CALL    ParentDir,dosbase(PC)
  547.             move.l  d0,d4
  548.             move.l  (a7)+,d1
  549.             CALL    UnLock,dosbase(PC)
  550.             move.l  d4,d0
  551.             bra     gp0
  552. putall      cmp.b   #'/',0(a5)
  553.             bne.s   gp2
  554.             move.b  #':',0(a5)
  555. gp2         move.l  a4,d0
  556.             bsr     putnam
  557.             movem.l (a7)+,d1-d7/a0-a6
  558.             rts
  559. strlen      move.l  a0,-(a7)
  560.             move.l  #-1,d0
  561. strl2       addq.l  #1,d0
  562.             tst.b   (a0)+
  563.             bne.s   strl2
  564.             move.l  (a7)+,a0
  565.             rts
  566. strlen2     move.l  a0,-(a7)
  567.             move.l  #-1,d0
  568. strl22      addq.l  #1,d0
  569.             cmp.b   #10,(a0)+
  570.             bne.s   strl22
  571.             move.l  (a7)+,a0
  572.             rts
  573.  
  574. ;write a title and underline
  575. ;a0 = pointer to text
  576. puthead1    bsr     strlen
  577.             move.l  d0,d5
  578.             move.l  a0,d0
  579.             bra     putstr
  580.  
  581. puthead2    bsr     strlen
  582.             add.l   d0,d5
  583.             bra.s   ph2
  584.  
  585. puthead     bsr     strlen
  586.             move.l  d0,d5
  587. ph2         move.l  a0,d0
  588.             bsr     putnam
  589.             lea     out,a0
  590.             move.l  a0,d0
  591. ph1         move.b  #'-',(a0)+
  592.             dbf     d5,ph1
  593.             move.b  #$9b,(a0)+
  594.             move.b  #'K',(a0)+
  595.             move.b  #$0a,(a0)+
  596.             clr.b   0(a0)
  597.             bra     putstr
  598.  
  599. ;move cursor to a column
  600. ;d0 = current position
  601. ;d1 = column
  602. tab         move.l  a3,-(a7)
  603.             lea     out,a3
  604. sp5         cmp.b   d1,d0
  605.             bcc.s   sp4
  606.             move.b  #' ',0(a3,d0)
  607.             addq.b  #1,d0
  608.             bra.s   sp5
  609. sp4         move.l  d1,ptr
  610.             move.l  (a7)+,a3
  611.             rts
  612.  
  613. ;convert ascii to byte
  614. ;a0 = pointer to text
  615. ;d0 = byte
  616. getnum      cmp.b   #'$',0(a0)
  617.             bne.s   isdec
  618.             bsr     readhex
  619.             move.l  d0,d2
  620.             rts
  621. isdec       clr.w   d2
  622.             clr.w   d3
  623.             clr.b   d6
  624.             clr.b   d7
  625.             cmp.b   #'-',0(a0)
  626.             bne.s   gn1
  627.             lea     1(a0),a0
  628.             moveq.l #1,d6
  629. gn1         move.b  (a0)+,d3
  630.             cmp.b   #'9',d3
  631.             bhi.s   gn2
  632.             cmp.b   #'0',d3
  633.             bcs.s   gn2
  634.             moveq.l #1,d7
  635.             and.b   #$f,d3
  636.             muls    #10,d2
  637.             add.w   d3,d2
  638.             bra.s   gn1
  639. gn2         tst.b   d6
  640.             beq.s   gn3
  641.             neg.w   d2
  642. gn3         tst.b   d7
  643.             bne.s   gn4
  644.             lea     -1(a0),a0
  645. gn4         rts
  646.  
  647. ;convert hex to longword
  648. ;a0 = pointer to text
  649. ;returns d0=value
  650. ;d7 = ok/error 1/0
  651. readhex     movem.l d1-d6/a1-a5,-(a7)
  652.             moveq   #1,d7
  653.             cmp.b   #'$',0(a0)
  654.             bne.s   rh3
  655.             lea     1(a0),a0
  656. rh3         clr.l   d0
  657.             cmpi.b  #10,0(a0)
  658.             beq.s   rherr
  659.             lea     hextab(pc),a1
  660. rh0         move.b  (a0)+,d3
  661.             moveq.l #15,d2
  662. rh1         cmp.b   0(a1,d2),d3
  663.             beq.s   rh2
  664.             dbf     d2,rh1
  665.             bra     rhend
  666. rh2         lsl.l   #4,d0
  667.             or.b    d2,d0
  668.             bra.s   rh0
  669. rhend       tst.b   d3
  670.             beq.s   rhok
  671.             cmpi.b  #10,d3
  672.             beq.s   rhok
  673.             cmpi.b  #' ',d3
  674.             beq.s   rhok
  675. rherr       clr.l   d7
  676. rhok        movem.l (a7)+,d1-d6/a1-a5
  677.             rts
  678.  
  679. ;skip blanks
  680. ;a0 pointer to text
  681. ; returns a0 = new pointer position
  682. kllblnks    cmpi.b  #' ',0(a0)
  683.             bne.s   gn4
  684.             lea     1(a0),a0
  685.             bra.s   kllblnks
  686.  
  687. ; exit program. If background flag is set, wait for
  688. ; amiga-amiga-x
  689.  
  690. stopall     lea     4(a7),a7
  691.             bra     exitall
  692.  
  693. exit        tst.b   background
  694.             bne     quithold
  695. exitall     move.l  stplist(PC),a3
  696.             tst.l   0(a3)
  697.             beq.s   ex0
  698.             move.l  a3,d0
  699.             bsr     waok
  700.             bra.s   exitall
  701.  
  702. ex0         tst.b   background
  703.             beq.s   ex1
  704.             bsr     removeh
  705.  
  706. ex1         move.l  _SysBase(PC),a1
  707.             move.l  #_LVOSwitch,a0
  708.             move.l  oldswitch,d0
  709.             CALL    SetFunction,_SysBase(PC)
  710.             move.l  #3,d0
  711.             lea     IOCounter(PC),a1
  712.             CALL    RemIntServer,_SysBase(PC)
  713.  
  714.             move.l  replyport(PC),-(a7)
  715.             LIBCALL DeletePort
  716.             lea     4(a7),a7
  717.             move.l  fileptr(PC),d1
  718.             beq.s   ex11
  719.             CALL    Close,dosbase(PC)
  720. ex11        bsr     freehidmem
  721.         IFND DEBUG
  722.             CALL    Forbid,_SysBase(PC)
  723.             move.l  wbmsg(PC),d0
  724.             beq.s   todos
  725.             move.l  d0,a1
  726.             CALL    ReplyMsg,_SysBase(PC)
  727.             clr.l   d0
  728.             rts
  729.  
  730. todos       move.l  myseg(PC),d1
  731.             CALL    UnLoadSeg,dosbase(PC)
  732.         ENDC
  733.             clr.l   d1
  734.             CALL    Exit,dosbase(PC)
  735.  
  736. ;print a bcpl-string
  737. ;d0 = bcpl-pointer to bcpl-string
  738. putbcpl     movem.l d3/a0-a1,-(a7)
  739.             tst.l   d0
  740.             beq.s   pb1
  741.             lsl.l   #2,d0
  742.             move.l  d0,a1
  743.             clr.l   d3
  744.             move.b  (a1)+,d3
  745.             move.l  ptr(PC),d0
  746.             lea     out,a0
  747. pb2         move.b  (a1)+,0(a0,d0)
  748.             addq.b  #1,d0
  749.             dbf     d3,pb2
  750.             move.l  d0,ptr
  751. pb1         movem.l (a7)+,d3/a0-a1
  752.             rts
  753.  
  754. ;compare strings
  755. ;a0/a1 = pointers to string
  756. ;returns d0 = true(0) false(1)
  757. strcmp      movem.l a0-a1,-(a7)
  758.             clr.l   d0
  759. src2        move.b  (a0)+,d0
  760.             beq.s   src1
  761.             cmp.b   #10,d0
  762.             beq.s   src1
  763.             cmp.b   (a1)+,d0
  764.             beq.s   src2
  765.             bra.s   src3
  766. src1        move.b  0(a1),d0
  767. src3        movem.l (a7)+,a0-a1
  768.             rts
  769.  
  770. ;compare bcpl string with string
  771. ;a0 = pointer to string
  772. ;a2 = bcpl-pointer to bcpl-string
  773. ;returns d0 = true(0) false(1)
  774. strbcmp     movem.l d1/a0/a2,-(a7)
  775.             clr.l   d0
  776.             clr.l   d1
  777.             adda.l  a2,a2
  778.             adda.l  a2,a2
  779.             move.b  (a2)+,d1
  780.             beq.s   stb1
  781.             subq    #1,d1
  782. stb2        cmp.b   (a2)+,(a0)+
  783.             bne.s   stb1
  784.             dbf     d1,stb2
  785.             moveq   #1,d0
  786. stb1        movem.l (a7)+,d1/a0/a2
  787.             rts
  788.  
  789. ;concat strings
  790. ;a0 = pointer to string
  791. ;a1 = pointer to string to be appended
  792. ;returns d0 = strlen
  793. strcat      movem.l d1/a0-a1,-(a7)
  794.             bsr     strlen
  795.             move.l  d0,d1
  796.             exg     a0,a1
  797.             bsr     strlen
  798.             adda.w  d1,a1
  799. stc1        move.b  (a0)+,(a1)+
  800.             dbf     d0,stc1
  801.             move.l  a1,d0
  802.             movem.l (a7)+,d1/a0-a1
  803.             sub.l   a0,d0
  804.             rts
  805.  
  806. ;convert long to decimal
  807. ;d0 = value
  808. ;d3 bit 0 = left/right justified
  809. ;d3 bit 1 = write/leave
  810. ;returns string in 'buffer'
  811. longdec     movem.l d1-d2/a1-a2,-(a7)
  812.             lea     binarea+8(PC),a1
  813.             move.l  #'    ',-8(a1)
  814.             move.l  #'    ',-4(a1)
  815.             clr.b   0(a1)
  816.             lea     -1(a1),a1
  817.             cmp     #2,d3
  818.             bne.s   ld5
  819.             clr.b   0(a1)
  820. ld5         moveq   #1,d2
  821. ld2         addq    #1,d2
  822.             moveq   #$a,d1
  823.             bsr     div
  824.             addi.l  #$30,d1
  825.             move.b  d1,-(a1)
  826.             tst.l   d0
  827.             bne.s   ld2
  828.  
  829.             btst    #0,d3
  830.             bne.s   ld1
  831.             lea     binarea(PC),a2
  832. ld3         move.b  0(a1),(a2)+
  833.             move.b  #' ',(a1)+
  834.             dbf     d2,ld3
  835. ld1         cmp     #2,d3
  836.             beq.s   ld4
  837.             move.l  #binarea,d0
  838.             bsr     putstr
  839. ld4         movem.l (a7)+,d1-d2/a1-a2
  840.             rts
  841.  
  842. ;write UBYTE
  843. ;d3 = value
  844. bytedec     move.l  #dezimal,d0
  845. pm1         bsr     dec
  846.             bra     putstr
  847.  
  848. ;write signed byte
  849. ;d3 = value
  850. plusmins    move.l  #minus+1,d0
  851.             move.w  #$2020,minus
  852.             tst.b   d3
  853.             bpl.s   pm1
  854.             neg.b   d3
  855.             jsr     dec
  856.             move.b  #'-',-(a3)
  857.             bra.s   putstr
  858.  
  859. dec         move.l  #$20202020,dezimal
  860.             clr.l   d4
  861.             and.l   #$ff,d3
  862.             lea     dezimal+3(PC),a3
  863. bloop       tst.b   d3
  864.             beq.s   bend
  865.             divu    #10,d3
  866.             swap    d3
  867.             ori.b   #48,d3
  868.             move.b  d3,-(a3)
  869.             clr.w   d3
  870.             swap    d3
  871.             bra.s   bloop
  872. bend        cmpa.l  #dezimal+3,a3
  873.             bne     nixfirst
  874.             move.b  #'0',-(a3)
  875. nixfirst    rts
  876.  
  877. ;write a string, move cursor into next line
  878. ;d0 = pointer to text
  879. putnam      bsr     putstr
  880.             tst.b   d0
  881.             beq.s   ncr
  882.             bsr     newline
  883. ncr         rts
  884.  
  885. ;write one char
  886. ;d0 = char
  887. putchar     movem.l d1/a0,-(a7)
  888.             move.l  ptr(PC),d1
  889.             lea     out,a0
  890.             move.b  d0,0(a0,d1)
  891.             add.l   #1,ptr
  892.             movem.l (a7)+,d1/a0
  893.             rts
  894.  
  895. ;write a string, strings are only written when they end with LF
  896. ;d0 = pointer to string
  897. ;returns d0 = cursor position
  898. putstr      movem.l d1-d7/a0-a6,-(a7)
  899.             move.b  #1,printed
  900.             move.l  d0,a2
  901.             lea     out,a3
  902.             move.l  ptr(PC),d0
  903.             cmp.l   #0,a2
  904.             beq     prend
  905.             clr     d5
  906. pst1        addq    #1,d5
  907.             cmp     #81,d3
  908.             beq     prend
  909.             move.b  (a2)+,d1
  910.             cmpi.b  #13,d1
  911.             beq     pst1
  912.             move.b  d1,0(a3,d0)
  913.             beq     prend
  914.             addq    #1,d0
  915.             cmpi.b  #$0a,d1
  916.             bne.s   pst1
  917.             tst.b   fromfile
  918.             bne.s   pst24
  919.             move.l  d0,d3
  920.             move.l  a3,d2
  921.             move.l  fileptr,d1
  922.             CALL    Write,dosbase(PC)
  923. pst24       clr.l   d0
  924.             clr     d5
  925.             tst.b   morefl
  926.             beq.s   pst1
  927.             tst.b   mnflag
  928.             beq.s   pst1
  929.             add.b   #1,row
  930.             move.b  row(PC),d1
  931.             cmp.b   rows,d1
  932.             bne.s   pst1
  933.             move.l  #50,d2
  934.             move.l  fileptr(PC),d1
  935.             CALL    WaitForChar,dosbase(PC)
  936.             beq.s   pst23
  937.             bsr     readline
  938. pst23       move.l  #6,d3
  939.             move.l  fileptr(PC),d1
  940.             move.l  #more,d2
  941.             CALL    Write,dosbase(PC)
  942.             bsr     readline
  943.             bsr     raw
  944.             clr.b   row
  945.             move.l  fileptr(PC),d1
  946.             move.l                                        #1,d3
  947.             move.l  #thisline,d2
  948.             CALL    Write,dosbase(PC)
  949.             clr.l   d0
  950.             bra     pst1
  951. prend       move.l  d0,ptr
  952.             movem.l (a7)+,d1-d7/a0-a6
  953.             rts
  954.  
  955. ;Write 8 byte hex value
  956. ;d0 = value
  957. hex8        movem.l d1-d7/a0-a6,-(a7)
  958.             moveq.l #7,d5
  959.             lea     hex8area(PC),a1
  960.             bra     hx1
  961.  
  962. ;Write 6 byte hex value
  963. ;d0 = value
  964. hexa        movem.l d1-d7/a0-a6,-(a7)
  965.             moveq.l #5,d5
  966.             lea     hexarea(PC),a1
  967. hx1         lea     hextab(PC),a0
  968.             clr.l   d2
  969. hexloop     move.b  d0,d2
  970.             and.b   #15,d2
  971.             move.b  0(a0,d2),0(a1,d5)
  972.             lsr.l   #4,d0
  973.             dbf     d5,hexloop
  974.             move.l  a1,d0
  975.             movem.l (a7)+,d1-d7/a0-a6
  976.             bra     putstr
  977.  
  978. ;Convert/write byte into binary string
  979. ;d0 = value
  980. bin         movem.l d1-d7/a0-a6,-(a7)
  981.             move.b  #' ',binarea+9
  982.             moveq.l #7,d4
  983.             lea     binarea(PC),a0
  984. binloop     moveq.l #'0'/2,d1
  985.             roxr.b  #1,d0
  986.             roxl.b  #1,d1
  987.             move.b  d1,0(a0,d4)
  988.             dbf     d4,binloop
  989.             move.l  a0,d0
  990.             movem.l (a7)+,d1-d7/a0-a6
  991.             bra     putstr
  992.  
  993. ;read one line of input string
  994. readline    tst.b   fromfile
  995.             bne.s   rlin1
  996.             move.l  fileptr(PC),d1
  997.             move.l  #dummy,d2
  998.             moveq.l #80,d3
  999.             CALL    Read,dosbase(PC)
  1000.             rts
  1001. rlin1       lea     dummy,a3
  1002. rlin4       move.l  infile(PC),d1
  1003.             move.l  a3,d2
  1004.             moveq.l #1,d3
  1005.             CALL    Read,dosbase(PC)
  1006.             tst.l   d0
  1007.             beq.s   rlin5
  1008.             cmp.b   #10,(a3)+
  1009.             beq.s   rlin2
  1010.             bra.s   rlin4
  1011. rlin5       move.b  #1,eof
  1012. rlin3       move.b  #10,0(a3)
  1013. rlin2       lea     dummy,a0
  1014.             bsr     strlen2
  1015.             addq    #1,d0
  1016.             rts
  1017.  
  1018. ;switch console to con: mode & empty input buffer
  1019. con         tst.b   fromfile
  1020.             bne.s   conend
  1021.             bsr     cmdcon
  1022.             move.l  #50,d2
  1023.             move.l  fileptr(PC),d1
  1024.             CALL    WaitForChar,dosbase(PC)
  1025.             beq.s   conend
  1026.             bsr     readline
  1027. conend      rts
  1028.  
  1029.  
  1030. cmdcon      clr.l   dp_Arg1
  1031.             move.l  conmsg(PC),a0
  1032.             move.l  #994,dp_Type
  1033.             bra.s   cons1
  1034.  
  1035. ;switch console window to raw mode
  1036. raw         tst.b   fromfile
  1037.             bne.s   conend
  1038.             move.l  conmsg(PC),a0
  1039.             move.l  #994,dp_Type
  1040.             move.l  #-1,dp_Arg1
  1041.  
  1042. ;send a packet
  1043. ;a0 = msgport
  1044. ;dp_Type and dp_Arg1 have to be inizialized
  1045. cons1       movem.l d0-d7/a0-a6,-(a7)
  1046.             move.l  #dp_Link,LN_NAME
  1047.             move.l  #mypacket,dp_Link
  1048.             move.l  replyport(PC),dp_Port
  1049.             lea     mypacket,a1
  1050.             CALL    PutMsg,_SysBase(PC)
  1051.             move.l  replyport,a0
  1052.             CALL    WaitPort,_SysBase(PC)
  1053.             move.l  replyport(PC),a0
  1054.             CALL    GetMsg,_SysBase(PC)
  1055.             movem.l (a7)+,d0-d7/a0-a6
  1056.             rts
  1057.  
  1058. ;32-bit division
  1059. ;d0 / d1
  1060. ;returns d0
  1061. div         movem.l d2-d3,-(a7)
  1062.             swap    d1
  1063.             move.w  d1,d2
  1064.             bne.s   div1
  1065.             swap    d0
  1066.             swap    d1
  1067.             swap    d2
  1068.             move.w  d0,d2
  1069.             beq.s   div2
  1070.             divu    d1,d2
  1071.             move.w  d2,d0
  1072. div2        swap    d0
  1073.             move.w  d0,d2
  1074.             divu    d1,d2
  1075.             move.w  d2,d0
  1076.             swap    d2
  1077.             move.w  d2,d1
  1078.             bra     div8
  1079. div1        moveq   #$10,d3
  1080.             cmpi.w  #$80,d1
  1081.             bcc.s   div3
  1082.             rol.l   #8,d1
  1083.             subq.w  #8,d3
  1084. div3        cmpi.w  #$800,d1
  1085.             bcc.s   div4
  1086.             rol.l   #4,d1
  1087.             subq.w  #4,d3
  1088. div4        cmpi.w  #$2000,d1
  1089.             bcc.s   div5
  1090.             rol.l   #2,d1
  1091.             subq.w  #2,d3
  1092. div5        tst.w   d1
  1093.             bmi.s   div6
  1094.             rol.l   #1,d1
  1095.             subq.w  #1,d3
  1096. div6        move.w  d0,d2
  1097.             lsr.l   d3,d0
  1098.             swap    d2
  1099.             clr.w   d2
  1100.             lsr.l   d3,d2
  1101.             swap    d3
  1102.             divu    d1,d0
  1103.             move.w  d0,d3
  1104.             move.w  d2,d0
  1105.             move.w  d3,d2
  1106.             swap    d1
  1107.             mulu    d1,d2
  1108.             sub.l   d2,d0
  1109.             bcc.s   div7
  1110.             subq.w  #1,d3
  1111.             add.l   d1,d0
  1112. div7        moveq   #0,d1
  1113.             move.w  d3,d1
  1114.             swap    d3
  1115.             rol.l   d3,d0
  1116.             swap    d0
  1117.             exg     d1,d0
  1118. div8        movem.l (a7)+,d2-d3
  1119.             rts
  1120.  
  1121. ;install a input-handler
  1122. installh    pea     0
  1123.             pea     xopsleep
  1124.             LIBCALL CreatePort
  1125.             lea     8(a7),a7
  1126.             move.l  d0,InputMsg
  1127.             move.l  d0,-(a7)
  1128.             LIBCALL CreateStdIO
  1129.             lea     4(a7),a7
  1130.             move.l  d0,InRequest
  1131.             move.l  d0,a1
  1132.             lea     devicenam(PC),a0
  1133.             clr.l   d0
  1134.             clr.l   d1
  1135.             CALL    OpenDevice,_SysBase(PC)
  1136.             move.l  d0,devstatus
  1137.             movea.l InRequest(PC),a1
  1138.             move.l  #InInterrupt,40(a1)
  1139.             move.w  #9,28(a1)
  1140.             CALL    DoIO,_SysBase(PC)
  1141.             move.l  d0,iostatus
  1142.             move.l  #-1,d0
  1143.             CALL    AllocSignal,_SysBase(PC)
  1144.             clr.l   d1
  1145.             bset    d0,d1
  1146.             move.l  d1,mysignal
  1147.             rts
  1148.  
  1149. ;remove handler
  1150. removeh     movea.l InRequest(PC),a1
  1151.             move.l  #InInterrupt,40(a1)
  1152.             move.w  #10,28(a1)
  1153.             CALL    DoIO,_SysBase(PC)
  1154.             movea.l InRequest(PC),a1
  1155.             CALL    CloseDevice,_SysBase(PC)
  1156.             move.l  InRequest,-(a7)
  1157.             LIBCALL DeleteStdIO
  1158.             lea     4(a7),a7
  1159.             move.l  InputMsg,-(a7)
  1160.             LIBCALL DeletePort
  1161.             lea     4(a7),a7
  1162.             rts
  1163.  
  1164. ;this is the handler, it checks if amiga-amiga-x
  1165. ;has been pressed and signals it to our task
  1166. Keyhandler  tst.b   running
  1167.             bne.s   endhandler
  1168.             cmp.b   #1,4(a0)
  1169.             bne.s   endhandler
  1170.             move.w  8(a0),d0
  1171.             andi.w  #$c0,d0
  1172.             cmpi.w  #$c0,d0
  1173.             bne.s   endhandler
  1174.             cmp.w   #$32,6(a0)
  1175.             bne.s   endhandler
  1176. wakeup      move.l  a0,-(a7)
  1177.             movea.l mytask(PC),a1
  1178.             move.l  mysignal(PC),d0
  1179.             CALL    Signal,_SysBase(PC)
  1180.             move.l  (a7)+,a0
  1181.             clr.b   4(a0)
  1182. endhandler  move.l  a0,d0
  1183.             rts
  1184.  
  1185. snoop       bsr     nodenam
  1186.             moveq.l #2,d7
  1187.             lea     TRuNode(PC),a4
  1188.             bsr     findnam
  1189.             tst.b   d7
  1190.             beq     tm6
  1191.             move.l  d0,captask
  1192.             pea     0
  1193.             pea     memportname
  1194.             LIBCALL CreatePort
  1195.             lea     8(a7),a7
  1196.             move.l  d0,snoopport
  1197.             beq     tm6
  1198.             lea     snoophead(PC),a0
  1199.             bsr     puthead
  1200.             move.l  _SysBase(PC),a1
  1201.             move.l  -196(a1),oldalloc
  1202.             move.l  -208(a1),oldfree
  1203.             move.l  #capmalloc,d0
  1204.             move.l  #-198,a0
  1205.             CALL    SetFunction,_SysBase(PC)
  1206.             move.l  _SysBase(PC),a1
  1207.             move.l  #capmfree,d0
  1208.             move.l  #-210,a0
  1209.             CALL    SetFunction,_SysBase(PC)
  1210.             clr.b   bool
  1211.             clr.b   cbreak
  1212.             bsr     con
  1213. waitmem     move.l  snoopport(PC),a0
  1214.             move.l  #$1000,d0
  1215.             clr.l   d1
  1216.             move.b  15(a0),d1
  1217.             bset    d1,d0
  1218.             CALL    Wait,_SysBase(PC)
  1219.             btst    #12,d0
  1220.             beq.s   tm7
  1221.             move.b  #1,cbreak
  1222. tm7         move.l  mytask(PC),a0
  1223.             move.l  snoopport(PC),a0
  1224.             CALL    GetMsg,_SysBase(PC)
  1225.             tst.l   d0
  1226.             bne     tm8
  1227.             tst.b   cbreak
  1228.             bne     snoopend
  1229.             bra     waitmem
  1230. tm8         move.l  d0,a3
  1231.             move.l  20(a3),d3
  1232.             btst    #31,d3
  1233.             beq     freed
  1234.             move.l  #allok,d0
  1235.             bsr     putstr
  1236.             lea     memname(PC),a2
  1237.             lea     membit(PC),a4
  1238.             move.l  #4,d5
  1239. tm2         move.l  0(a4),d4
  1240.             btst    d4,d3
  1241.             beq.s   tm1
  1242.             move.l  0(a2),d0
  1243.             bsr     putstr
  1244. tm1         lea     4(a2),a2
  1245.             lea     4(a4),a4
  1246.             dbf     d5,tm2
  1247.             move.l  #26,d1
  1248.             bsr     tab
  1249.             move.l  24(a3),d0
  1250.             move.l  d0,d3
  1251.             bsr     hexa
  1252.             move.l  28(a3),d0
  1253.             bne.s   tm3
  1254.             move.l  #failed,d0
  1255.             bsr     putstr
  1256.             move.l  #47,d1
  1257.             bsr     tab
  1258.             bra     tm4
  1259. tm3         bsr     hexa
  1260.             move.l  28(a3),d0
  1261.             add.l   d3,d0
  1262.             bsr     hexa
  1263.             bra     tm4
  1264.  
  1265. freed       move.l  #free,d0
  1266.             bsr     putstr
  1267.             move.b  #'-',d0
  1268.             move.l  #18,d1
  1269. tm9         bsr     putchar
  1270.             dbf     d1,tm9
  1271.             move.b  #' ',d0
  1272.             bsr     putchar
  1273.             move.l  d3,d0
  1274.             bsr     hexa
  1275.             move.l  24(a3),d0
  1276.             bsr     hexa
  1277.             move.l  24(a3),d0
  1278.             add.l   d3,d0
  1279.             bsr     hexa
  1280.  
  1281. tm4         move.l  32(a3),d0
  1282.             bsr     hexa
  1283.             bsr     newline
  1284.             move.w  18(a3),d0
  1285.             ext.l   d0
  1286.             move.l  a3,a1
  1287.             CALL    FreeMem,_SysBase(PC)
  1288.             bra     tm7
  1289.  
  1290. snoopend    move.l  _SysBase(PC),a1
  1291.             move.l  oldalloc(PC),d0
  1292.             move.l  #-198,a0
  1293.             CALL    SetFunction,_SysBase(PC)
  1294.             move.l  _SysBase(PC),a1
  1295.             move.l  oldfree,d0
  1296.             move.l  #-210,a0
  1297.             CALL    SetFunction,_SysBase(PC)
  1298.             move.l  snoopport,-(a7)
  1299.             LIBCALL DeletePort
  1300.             lea     4(a7),a7
  1301. tm6         rts
  1302.  
  1303. memname     dc.l    memlarg,memclr,memfast,memchip,mempubl
  1304. membit      dc.l    17,16,2,1,0
  1305.  
  1306. capmalloc   movem.l d0-d7/a0-a6,-(a7)
  1307.             move.l  _SysBase(PC),a6
  1308.             move.l  276(a6),d4
  1309.             cmp.l   captask(PC),d4
  1310.             bne.s   capm1
  1311.             tst.b   bool
  1312.             bne     capm1
  1313.             move.b  #1,bool
  1314.             move.l  #36,d6
  1315.             bsr     allocmsg
  1316.             beq     capm2
  1317.             bset    #31,d1
  1318.             move.l  d1,20(a5)
  1319.             move.l  d0,24(a5)
  1320.             move.l  60(a7),32(a5)
  1321.             move.l  a5,remembr
  1322.             movem.l (a7)+,d0-d7/a0-a6
  1323.             bsr     memalloc
  1324.             movem.l d0-d7/a0-a6,-(a7)
  1325.             move.l  remembr(PC),a1
  1326.             move.l  d0,28(a1)
  1327.             move.l  snoopport,a0
  1328.             move.b  #5,8(a1)
  1329.             CALL    PutMsg,_SysBase(PC)
  1330.             clr.b   bool
  1331.             movem.l (a7)+,d0-d7/a0-a6
  1332.             rts
  1333. capm2       clr.b   bool
  1334. capm1       movem.l (a7)+,d0-d7/a0-a6
  1335. memalloc    dc.w    $4ef9
  1336. oldalloc    dc.l    0
  1337.  
  1338. capmfree    movem.l d0-d7/a0-a6,-(a7)
  1339.             move.l  _SysBase(PC),a6
  1340.             move.l  276(a6),d4
  1341.             cmp.l   captask(PC),d4
  1342.             bne.s   capf1
  1343.             tst.b   bool
  1344.             bne.s   capf1
  1345.             move.b  #1,bool
  1346.             move.l  #36,d6
  1347.             bsr     allocmsg
  1348.             beq.s   capf2
  1349.             move.l  d0,20(a5)
  1350.             move.l  a1,24(a5)
  1351.             move.l  60(a7),32(a5)
  1352.             move.l  snoopport,a0
  1353.             move.b  #5,8(a5)
  1354.             move.l  a5,a1
  1355.             CALL    PutMsg,_SysBase(PC)
  1356. capf2       clr.b   bool
  1357. capf1       movem.l (a7)+,d0-d7/a0-a6
  1358.             dc.w    $4ef9
  1359. oldfree     dc.l    0
  1360.  
  1361. allocmsg    movem.l d0-d1/a0-a1,-(a7)
  1362.             move.l  d6,d0
  1363.             move.l  #65536,d1
  1364.             bsr     memalloc
  1365.             tst.l   d0
  1366.             beq.s   alm1
  1367.             move.l  d0,a5
  1368.             move.w  d6,18(a5)
  1369. alm1        movem.l (a7)+,d0-d1/a0-a1
  1370.             move.l  a5,d6
  1371.             rts
  1372.  
  1373. capopendev  movem.l d0-d7/a0-a6,-(a7)
  1374.             move.l  _SysBase(PC),a6
  1375.             move.l  276(a6),d4
  1376.             cmp.l   captask(PC),d4
  1377.             bne.s   opdev1
  1378.             tst.b   bool
  1379.             bne.s   opdev1
  1380.             move.l  #36,d6
  1381.             bsr     allocmsg
  1382.             move.l  #0,d0
  1383. opdev1:
  1384. myswitch    movem.l d0-d1/a0,-(a7)
  1385.             move.l  _SysBase(PC),a0
  1386.             move.l  276(a0),d0
  1387.             move.l  tasksnum(PC),d1
  1388.             lea     cputime,a0
  1389.             subq.l  #1,d1
  1390.             bmi.s   swadd
  1391. sw0         cmp.l   0(a0),d0
  1392.             beq.s   swi1
  1393.             lea     8(a0),a0
  1394.             dbf     d1,sw0
  1395.             bra.s   swadd
  1396. swi1        add.l   #1,4(a0)
  1397. swgo        movem.l (a7)+,d0-d1/a0
  1398.             dc.w    $4ef9
  1399. oldswitch   dc.l    0
  1400. swadd       cmp.l   #125,tasksnum
  1401.             bge.s   swgo
  1402.             add.l   #1,tasksnum
  1403.             move.l  d0,0(a0)
  1404.             move.l  #1,4(a0)
  1405.             bra.s   swgo
  1406.  
  1407. countio     addq.l  #1,iocount
  1408.             rts
  1409.  
  1410. dosbase     dc.l    0
  1411. intuibase   dc.l    0
  1412. gfxbase     dc.l    0
  1413. window      dc.l    0
  1414. parmtxt     dc.l    0
  1415. fileptr     dc.l    0
  1416. infile      dc.l    0
  1417. conmsg      dc.l    0
  1418. ptr         dc.l    0
  1419. oldidl      dc.l    0
  1420. olddisp     dc.l    0
  1421. myseg       dc.l    0
  1422. mysignal    dc.l    0
  1423. iostatus    dc.l    -1
  1424. devstatus   dc.l    -1
  1425. cancelbit   dc.l    0
  1426. cancelbnum  dc.l    0
  1427. _SysBase    dc.l    0
  1428. InputMsg    dc.l    0
  1429. InRequest   dc.l    0
  1430. startmess   dc.l    0
  1431. savedat     dc.l    0
  1432. mytask      dc.l    0
  1433. wbmsg       dc.l    0
  1434. pointer     dc.l    0
  1435. replyport   dc.l    0
  1436. finfoptr    dc.l    0
  1437. dispatches  dc.l    0
  1438. maxdisp     dc.l    0
  1439. wbaddr      dc.l    0
  1440. remembr     dc.l    0
  1441. remembr2    dc.l    0
  1442. captask     dc.l    0
  1443. snoopport   dc.l    0
  1444. tasksnum    dc.l    0
  1445. hidestart   dc.l    0
  1446. iocount     dc.l    0
  1447. dummyinput  dc.l    0
  1448.  
  1449. secs        dc.l    0
  1450. mics        dc.l    0
  1451. time10      dc.l    0
  1452.  
  1453.  
  1454. stplist     dc.l    lh_tail
  1455. lh_tail     dc.l    0
  1456.             dc.l    stplist
  1457.             dc.b    1
  1458.             dc.b    0
  1459.  
  1460. InInterrupt dc.l    0           ;ln_Succ
  1461.             dc.l    0           ;ln_Pred
  1462.             dc.b    2           ;ln_Type
  1463.             dc.b    60          ;ln_Pri
  1464.             dc.l    xopsleep    ;ln_Name
  1465.             dc.l    0           ;is_Data
  1466.             dc.l    Keyhandler  ;is_Code()
  1467.  
  1468. IOCounter   dc.l    0           ;ln_Succ
  1469.             dc.l    0           ;ln_Pred
  1470.             dc.b    2           ;ln_Type
  1471.             dc.b    -1          ;ln_Pri
  1472.             dc.l    IOcntname   ;ln_Name
  1473.             dc.l    0           ;is_Data
  1474.             dc.l    countio     ;is_Code()
  1475.  
  1476. window_l    dc.w    0
  1477. window_t    dc.w    0
  1478. window_w    dc.w    550
  1479. window_h    dc.w    200
  1480.  
  1481. binarea     dc.b    '          ',0
  1482.             EVEN
  1483. minus       dc.b    '  '
  1484. dezimal     dc.b    '   '
  1485. blnk        dc.b    ' ',0
  1486. entries     dc.b    0
  1487. timeout     dc.b    5
  1488. procnum     dc.b    0
  1489. running     dc.b    0
  1490. newpri      dc.b    0
  1491. tasktyp     dc.b    0
  1492. background  dc.b    0
  1493. bool        dc.b    0
  1494. printed     dc.b    0
  1495. cbreak      dc.b    0
  1496. rows        dc.b    0
  1497. row         dc.b    0
  1498. usageflag   dc.b    0
  1499. morefl      dc.b    1
  1500. morefl2     dc.b    1
  1501. mnflag      dc.b    1
  1502. tports      dc.b    1
  1503. headon      dc.b    1
  1504. hideon      dc.b    1
  1505. sorton      dc.b    1
  1506. eof         dc.b    0
  1507. fromfile    dc.b    0
  1508. params      dc.b    'tfdlrempis'
  1509. parmnum     equ     *-params
  1510. t2header    dc.b    '  ID    STATE   SIGALLOC SIGWAIT  SIGRECVD   PC   TASKNAME',0
  1511. theader     dc.b    '  ID    TYPE      STATE    PRI  CPUSE NUM TASKNAME',0
  1512. lheader     dc.b    ' NODE  CNT VER REV  FLAGS   ',0
  1513. libnam      dc.b    'LIBRARY NAME',0
  1514. devnam      dc.b    'DEVICE NAME',0
  1515. resnam      dc.b    'RESOURCE NAME',0
  1516. mheader     dc.b    'LOWER  UPPER   FREE  ATTR  PRI HUNK NAME',0
  1517. nxtline     dc.b    $9b,'K'
  1518. cr          dc.b    10,0
  1519. iheader     dc.b    ' NODE   DATA   CODE   PRI   TYPE     INTERRUPT NAME',0
  1520. inheader    dc.b    ' NODE   DATA   CODE   PRI NAME',0
  1521. rheader     dc.b    ' ADDR   PRI  FLAGS   VER   TYPE    RESIDENT NAME',0
  1522. pheader     dc.b    ' NODE  PORTNAME        FLAGS SIGBT NUM SIGTASK',0
  1523. hunkheader  dc.b    ' BCPL   DATA  LENGTH',0
  1524. ddheader    dc.b    'DEVICE   HDS SECTORS  TRACKS BUFFERS STATE    HANDLER',0
  1525. cdheader    dc.b    'PROCESSNAME    CURRENT DIRECTORY',0
  1526. ofheader    dc.b    ' LOCK  ACCESS  SIZE   PATH/FILENAME',0
  1527. scrheader   dc.b    'NUM  ADDR  TITLE',0
  1528. fohead      dc.b    ' NODE  CNT  Y   X  TYPE  LO  HI NAME',0
  1529. kickhead    dc.b    'START  END    LENGTH',0
  1530. snoophead   dc.b    'ACTION REQUIREMENTS       LENGTH FROM   TO     CALLER',0
  1531. stackhead   dc.b    'SPLower   SIZE    USED TASKNAME',0
  1532. access      dc.b    ' Read  ',0
  1533.             dc.b    ' Write ',0
  1534. romfnt      dc.b    'Rom  ',0
  1535. diskfnt     dc.b    'Disk ',0
  1536. wbname      dc.b    'Workbench',0
  1537. status      dc.b    'Added    ',0
  1538.             dc.b    'Running  ',0
  1539.             dc.b    'Ready    ',0
  1540.             dc.b    'Waiting  ',0
  1541.             dc.b    'Exeption ',0
  1542.             dc.b    'Removed  ',0
  1543.             dc.b    'Frozen   ',0
  1544.             dc.b    'Frozen   ',0
  1545. type        dc.b    'Unknown   ',0
  1546.             dc.b    'Task      ',0
  1547.             dc.b    'Interrupt ',0
  1548.             dc.b    'Device    ',0
  1549.             dc.b    'Msgport   ',0
  1550.             dc.b    'Message   ',0
  1551.             dc.b    'Freemsg   ',0
  1552.             dc.b    'Replymsg  ',0
  1553.             dc.b    'Resource  ',0
  1554.             dc.b    'Library   ',0
  1555.             dc.b    'Memory    ',0
  1556.             dc.b    'Softint   ',0
  1557.             dc.b    'Font      ',0
  1558.             dc.b    'Process   ',0
  1559.             dc.b    'Semaphore ',0
  1560. mp_flags    dc.b    'Signal  ',0
  1561.             dc.b    'Softint ',0
  1562.             dc.b    'Ignore  ',0
  1563. windowname  dc.b    'Xoper V1.3  ) 1989 Werner Gunther',0
  1564. newname     dc.b    'Xoper',0
  1565. memportname dc.b    'MemSnoop',0
  1566. xopcon      dc.b    'XopPackets',0
  1567. xopsleep    dc.b    'Xop-A-A-x',0
  1568. IOcntname   dc.b    'Xop-I/O-counter',0
  1569.  
  1570.  
  1571. cmdnum      set      0
  1572. commds      ADDCMD  'time'
  1573.             ADDCMD  'taskpri'
  1574.             ADDCMD  'info'
  1575.             ADDCMD  'pri'
  1576.             ADDCMD  'flush'
  1577.             ADDCMD  'freeze'
  1578.             ADDCMD  'warm'
  1579.             ADDCMD  'signal'
  1580.             ADDCMD  'break'
  1581.             ADDCMD  'alert'
  1582.             ADDCMD  'lastalert'
  1583.             ADDCMD  'hold'
  1584.             ADDCMD  'exit'
  1585.             ADDCMD  'clear'
  1586.             ADDCMD  'cancel'
  1587.             ADDCMD  'more'
  1588.             ADDCMD  'taskports'
  1589.             ADDCMD  'hunks'
  1590.             ADDCMD  'devices'
  1591.             ADDCMD  'openlib'
  1592.             ADDCMD  'closelib'
  1593.             ADDCMD  'currentdir'
  1594.             ADDCMD  'cd'
  1595.             ADDCMD  'mypri'
  1596.             ADDCMD  'files'
  1597.             ADDCMD  'locks'
  1598.             ADDCMD  'unlock'
  1599.             ADDCMD  'screens'
  1600.             ADDCMD  'windows'
  1601.             ADDCMD  'closescreen'
  1602.             ADDCMD  'closewindow'
  1603.             ADDCMD  'fonts'
  1604.             ADDCMD  'windowfonts'
  1605.             ADDCMD  'lockdrive'
  1606.             ADDCMD  'freedrive'
  1607.             ADDCMD  'capture'
  1608.             ADDCMD  'clrcold'
  1609.             ADDCMD  'clrcool'
  1610.             ADDCMD  'clrwarm'
  1611.             ADDCMD  'snoop'
  1612.             ADDCMD  'usage'
  1613.             ADDCMD  'inputhandler'
  1614.             ADDCMD  'header'
  1615.             ADDCMD  'sort'
  1616.             ADDCMD  'hide'
  1617.             ADDCMD  'hidden'
  1618.             ADDCMD  'window'
  1619.             ADDCMD  'kill'
  1620. hex8area    dc.b    '  '
  1621. hexarea     dc.b    '       ',0
  1622. hextab      dc.b    '0123456789abcdef'
  1623. infoh2      dc.b    'Dispatches:',0
  1624. infoh1      dc.b    'CPU:',0
  1625. infoh3      dc.b    'CPU activity: ',0
  1626. infoh6      dc.b    'Total:',0
  1627. infoh4      dc.b    '% ',0
  1628. infoh7      dc.b    'I/O Ints/Sec: ',0
  1629. cpu0        dc.b    '68000',0
  1630. cpu1        dc.b    '68010',0
  1631. cpu2        dc.b    '68020',0
  1632. cpu3        dc.b    '/68881',0
  1633. syst        dc.b    'DF0:',0
  1634. devload     dc.b    'loaded   ',0
  1635. devnload    dc.b    'unloaded ',0
  1636. prompt      dc.b    $9b,'J','->',$9b,$20,$70
  1637. cls         dc.b    $9b,'0 ',$70,$9b,'H'
  1638. getwin      dc.b    $9b,$30,$20,$71
  1639. thisline    dc.b    $0d
  1640. notfile     dc.b    '--- ------- ------- ------- ',0
  1641. ganzlongnix dc.b    '-'
  1642. longnix     dc.b    '----'
  1643. nix         dc.b    '--- ',0
  1644. noinfo      dc.b    'No Info on ',0
  1645. namerr      dc.b    'Unable to find ',0
  1646. adrerr      dc.b    'Address Error!',0
  1647. noderr      dc.b    'Can`t find this Node. Continue ? (Y/N)',0
  1648. listerr     dc.b    'Unable to find ListHeader. Sort aborted.',0
  1649. wiwerr      dc.b    'Script file only',0
  1650. noguru      dc.b    'No Alert, shall I produce one ?',0
  1651. gurutxt     dc.b    'Guru Meditation #',0
  1652. clrtxt      dc.b    'Memory Hunks cleared.',0
  1653. canerr0     dc.b    'Process is not a CLI-task',10
  1654.             dc.b    'Has it been started from Workbench ? (Y/N)',10,0
  1655. canerr1     dc.b    'Process was created by CreateProc()',10
  1656.             dc.b    'Shall I UnLoad() ? (Y/N)',10,0
  1657. unloaderr   dc.b    'Arrrgh.. can`t find segments, aborting',0
  1658. noprocs     dc.b    'Not a Process.',0
  1659. notload     dc.b    'No program loaded.',0
  1660. cliprocs    dc.b    'Cli-Process',0
  1661. procloaded  dc.b    'Loaded as a command: ',0
  1662. segloaded   dc.b    'Created by CreateProc()',0
  1663. coldtxt     dc.b    'Cold Capture: ',0
  1664. cooltxt     dc.b    'Cool Capture: ',0
  1665. warmtxt     dc.b    'Warm Capture: ',0
  1666. kicktxt     dc.b    'KickMem     : ',0
  1667. unset       dc.b    'unset',0
  1668. intnames    dc.b    'Serial Out ',0
  1669.             dc.b    'Disk Block ',0
  1670.             dc.b    'SoftInt    ',0
  1671.             dc.b    'Ports      ',0
  1672.             dc.b    'Coper      ',0
  1673.             dc.b    'VBeam      ',0
  1674.             dc.b    'Blitter    ',0
  1675.             dc.b    'Audio Ch.0 ',0
  1676.             dc.b    'Audio Ch.1 ',0
  1677.             dc.b    'Audio Ch.2 ',0
  1678.             dc.b    'Audio Ch.3 ',0
  1679.             dc.b    'Serial In  ',0
  1680.             dc.b    'Disk Sync  ',0
  1681.             dc.b    'External   ',0
  1682.             dc.b    'SoftInt    ',0
  1683.             dc.b    'NMI        ',0
  1684. inttyp      dc.b    0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1
  1685. devicenam   dc.b    'input.device',0
  1686. memlarg     dc.b    'LARGEST ',0
  1687. memclr      dc.b    'CLEAR ',0
  1688. memfast     dc.b    'FAST ',0
  1689. memchip     dc.b    'CHIP ',0
  1690. mempubl     dc.b    'PUBLIC ',0
  1691. failed      dc.b    'Failed !',0
  1692. allok       dc.b    'ALLOC: ',0
  1693. free        dc.b    'FREE: ',0
  1694. startupname dc.b    'S:Xoper.Startup',0
  1695. synerr      dc.b    'Syntax Error, type "?" for help',10,0
  1696. more        dc.b    '<MORE>'
  1697. waittxt     dc.b    '<ANY KEY>',$9b,$4a
  1698. wberr       dc.b    'Can`t examine Workbench locks',0
  1699. dnotf       dc.b    'Directory not found',0
  1700. notdir      dc.b    'Not a directory',0
  1701. nomount     dc.b    ' not mounted.',0
  1702. dishelp     dc.b    10,'Names are case sensitive and followed by a ":"',0
  1703. unlerr      dc.b    'Lock not found',0
  1704. unl1        dc.b    'Lock is on ',0
  1705. unltxt      dc.b    'Old lock was: ',0
  1706. unltxt2     dc.b    'Unlock ? (Y/N)',10,0
  1707. scnofound   dc.b    'Screen not found.',0
  1708. winnofound  dc.b    'Window not found.',0
  1709. stperr      dc.b    'Task must be "READY" or "WAITING"',10,0
  1710. waerr       dc.b    'Task must be "FROZEN"',10,0
  1711. onscr       dc.b    'On Screen: ',0
  1712. usetxt      dc.b    $9b,'1mUSAGE:',$9b,'0m Xoper [T] [A] [L] [D] [R] [E] [M] [P] [I] [S]',$9b,'K',10
  1713.             dc.b    'OR     Xoper -b',$9b,'K',10
  1714.             dc.b    $9b,'1mDISPLAY:',$9b,'0m',$9b,'K',10
  1715.             dc.b    '[T]asks [F]=taskflags [L]ibraries [D]evices [R]esources',$9b,'K',10
  1716.             dc.b    'r[E]sident [M]emory [P]orts [I]nterrupts [S]tack [Q]uit',$9b,'K',10
  1717.             dc.b    $9b,'1mCOMMANDS:',$9b,'0m',$9b,'K',10
  1718.             dc.b    'Time         <secs>',$9b,'K',10
  1719.             dc.b    'Taskpri      <priority>  [processnum] <taskname>',$9b,'K',10
  1720.             dc.b    'Mypri        <priority>',$9b,'K',10
  1721.             dc.b    'Signal       <mask(hex)> [processnum] <taskname>',$9b,'K',10
  1722.             dc.b    'Break        [processnum] <taskname>',$9b,'K',10
  1723.             dc.b    'Freeze|Warm  [processnum] <taskname>',$9b,'K',10
  1724.             dc.b    'Kill         [processnum] <taskname>',$9b,'K',10
  1725.             dc.b    'Snoop        [processnum] <taskname>',$9b,'K',10
  1726.             dc.b    'Hide         <taskname>',$9b,'K',10
  1727.             dc.b    'Pri          <priority> <nodename>',$9b,'K',10
  1728.             dc.b    'Info         <name>',$9b,'K',10
  1729.             dc.b    'Clear        <longword(hex)>',$9b,'K',10
  1730.             dc.b    'Hunks        [processnum] <procname>',$9b,'K',10
  1731.             dc.b    'CD           <directory> [processnum] <procname>',$9b,'K',10
  1732.             dc.b    'Unlock       <lock>',$9b,'K',10
  1733.             dc.b    'Openlib    | Closelib <libraryname>',$9b,'K',10
  1734.             dc.b    'Closewindow| Closescreen <title>',$9b,'K',10
  1735.             dc.b    'Lockdrive  | Freedrive   <drivename:>',$9b,'K',10
  1736.             dc.b    'Window       <leftedge topedge width height> (scriptfile only) ',$9b,'K',10
  1737.             dc.b    'Flush,Devices,Currentdir,Files,Locks,Lastalert,More,Sort',$9b,'K',10
  1738.             dc.b    'Taskports,Windows,Screens,Fonts,Windowfonts,Capture,Hidden',$9b,'K',10
  1739.             dc.b    'ClrCool,ClrCold,ClrWarm,Usage,InputHandler,Header',$9b,'K',10
  1740.             dc.b    'Hold,Exit',$9b,'K',10
  1741. null        dc.b    0
  1742.  
  1743.     IFD DEBUG
  1744. dosname     dc.b    'dos.library',0
  1745. intuiname   dc.b    'intuition.library',0
  1746. gfxname     dc.b    'graphics.library',0
  1747.             EVEN
  1748.     ENDC
  1749.  
  1750.             BSS     blabla
  1751. buffer      ds.b    2000
  1752. fname       ds.b    284
  1753. out         ds.b    80
  1754. dummy       ds.b    80
  1755. in          ds.b    80
  1756. cputime     ds.b    1000
  1757.  
  1758. mypacket    BSS     standardpacket
  1759.  
  1760. LN_SUCC     ds.l    1
  1761. LN_PRED     ds.l    1
  1762. LN_TYPE     ds.b    1
  1763. LN_PRI      ds.b    1
  1764. LN_NAME     ds.l    1
  1765. MP_FLAGS    ds.b    1
  1766. MP_SIGBIT   ds.b    1
  1767. MP_SIGTASK  ds.l    1
  1768. MN_SIZE     ds.w    1
  1769. LH_HEAD     ds.l    1
  1770. LH_TAIL     ds.l    1
  1771. LH_TAILPRED ds.l    1
  1772. LH_TYPE     ds.b    1
  1773. LH_pad      ds.b    1
  1774. dp_Link     ds.l    1
  1775. dp_Port     ds.l    1
  1776. dp_Type     ds.l    1
  1777. dp_Res1     ds.l    1
  1778. dp_Res2     ds.l    1
  1779. dp_Arg1     ds.l    1
  1780. dp_Arg2     ds.l    1
  1781. dp_Arg3     ds.l    1
  1782. dp_Arg4     ds.l    1
  1783. dp_Arg5     ds.l    1
  1784. dp_Arg6     ds.l    1
  1785. dp_Arg7     ds.l    1
  1786.             END
  1787.  
  1788. SHAR_EOF
  1789. cat << \SHAR_EOF > Xoper.doc
  1790.                                  Xoper V1.3
  1791.  
  1792.                     Copyright (c) Werner Gunther 1989
  1793.  
  1794. Xoper is a freeware program to display and to control system activity.
  1795. Permition is granted to freely distribute this program.
  1796.  
  1797. --------------------------------------------------------------------------
  1798. Changes in V1.2:
  1799. New commands: Snoop, Capture, ClrCool, ClrWarm, ClrCold.
  1800. Added       : CPU usage by task.
  1801.  
  1802. Cancel command has been rewritten, some minor bugs removed.
  1803. --------------------------------------------------------------------------
  1804. Changes in V1.3:
  1805. New commands: [S]=Stack usage, Sort, Hide, Hidden, Header, Window,
  1806.               InputHandler.
  1807. Added       : Support of startup-scripts, I/O Interrupts/second, 'Kill' an
  1808.               alias for 'Cancel'.
  1809. Some BIG bugs have been removed: The port-display used to GURU if more than
  1810. 32 Ports did exist. The Cli Xoper has been started did act like having a
  1811. priority of 128. Unlock didn't unlock sometimes, the interrupt/priority
  1812. field did contain rubbish, Currentdir didn't examine all Processes.
  1813. There were some more, minor bugs, all (hopefully) removed.
  1814. --------------------------------------------------------------------------
  1815.  
  1816. Starting Xoper from CLI:
  1817.  
  1818. Xoper [T] [F] [S] [L] [D] [R] [E] [M] [P] [I]
  1819.  
  1820. These parameters are described below. For all those who like long
  1821. Startup-Sequences, overcrowded memory and hot-keys enter
  1822.  
  1823. Xoper -b
  1824.  
  1825. This will install Xoper in background waiting for LeftAmiga-RightAmiga-X
  1826. to pop up. In both cases you don't have to RUN or RUNBACK Xoper, it will
  1827. always create its own process.
  1828.  
  1829. At startup Xoper loads and executes a file named S:Xoper.Startup if such a
  1830. file is available. This startup-script is used to set default values, the
  1831. window size or the initial default list to be displayed. The Xoper-window
  1832. will only be opened after the startup-script has been processed. Look at the
  1833. end of the document for a sample startup file.
  1834.  
  1835. Xoper Commands:
  1836. ---------------
  1837.  
  1838.  Commands can be entered after the prompt '->', these are divided into two
  1839. groups:
  1840.  
  1841. Display commands: These are always single character entries and may be
  1842. specified in any order, upper or lower case, with or w/o embedded blanks,
  1843. after the prompt or from CLI as parameters:
  1844.  
  1845. T = Tasks (Default if Xoper is called without parameters)
  1846. Task node (HEX), Display type, status, priority (decimal), CPU usage
  1847. (percent), processnumber for Dos-Processes (decimal), taskname.
  1848.  
  1849. F = Task Flags
  1850. Task node (HEX), Allocated Signals (HEX), Signals the Task is waiting for
  1851. (HEX), Signals received (HEX), Address of the next instruction to be
  1852. executed (HEX).
  1853.  
  1854. L = Libraries
  1855. Base address (HEX), open count (decimal), version (decimal), revision
  1856. (decimal), flags (binary), libraryname.
  1857.  
  1858. D = Devices
  1859. Base address (HEX), open count (decimal), version (decimal), revision
  1860. (decimal), flags (binary), devicename.
  1861.  
  1862. E = Resident (sorry)
  1863. Base address (HEX), priority (decimal), flags (binary), version
  1864. (decimal), type, name.
  1865.  
  1866. R = Resources
  1867. Base address (HEX), open count (decimal), version (decimal), revision
  1868. (decimal), flags (binary), resource name.
  1869.  
  1870. M = Memory
  1871. Lower and upper bounds (HEX), bytes free (decimal), attributes, priority
  1872. (decimal), hunk name.
  1873.  
  1874. P = Ports
  1875. Node address (HEX), portname, flags, signal bit (decimal), queue length
  1876. [number of messages] (decimal), taskname.
  1877.  
  1878. I = Interrupts
  1879. Node address (HEX), pointer to interrupt data (HEX), pointer to interrupt
  1880. code (HEX), priority (decimal),type [interrupt queue the interrupt belongs
  1881. to], interrupt name.
  1882.  
  1883. S = Stack
  1884. Lower limit of the stack, stack size, currently used stacksize, taskname.
  1885. If you want to minimize your stack using this utility, please note that
  1886. Dos-functions use 1500 Bytes at the bottom of the Stack frame for their own
  1887. purposes and note that the stacksize is only checked one time per second by
  1888. this command.
  1889.  
  1890. H = Help ( or ?)
  1891. Show a list of commands.
  1892.  
  1893. ; = NOP
  1894. Skip this line (used for remarks in a script file)
  1895.  
  1896. Q = Quit
  1897. Same as QUIT (see below).
  1898.  
  1899. Example: Entering TPM would display Tasks, Ports and Memory. The display
  1900. would be updated after a few seconds (5 by default, may be changed
  1901. anytime, see below.)
  1902.  
  1903. Other commands that do not display lists:
  1904. These commands may be entered upper or lower case. Parameters enclosed
  1905. in '<>' must be, enclosed in '[]' may be specified. Names are usually
  1906. entered as ascii-strings, it can however happen that two or more nodes of
  1907. the same name exist. On tasks you may specify the DOS-Processnumber to
  1908. sort them out. If everything fails, you can enter the Node-Address with a
  1909. leading '$'. This Address will be checked first before the command is being
  1910. executed. If the check fails, you'll get an error message or a warning or
  1911. a prompt, depending on what went wrong. Names are always the last parameter
  1912. to enter. This may seem strange, but it is the simplest way to get rid of
  1913. embedded blanks.
  1914.  
  1915. Time <seconds>
  1916. Set time between updates. Minimum is 1 second, maximum is 255, default is 5
  1917. seconds.
  1918. Example: Time 1
  1919.  
  1920. Taskpri <priority> [processnumber] <taskname>
  1921. Change the priority of a task. Values may range from -127 to 127, better
  1922. use values between -5 and 5.
  1923. Example: Taskpri 5 New Cli
  1924.  
  1925. Mypri <priority>
  1926. Shortcut for "Taskpri Xoper <priority>"
  1927. Example: Mypri 6
  1928.  
  1929. Pri <priority> <nodename>
  1930. Change the priority of any other node. This command does not work for Tasks.
  1931. If the specified node has been found, the entire list the node belongs to
  1932. will be resorted.
  1933. Example: Pri 1 Chip Memory        (try to allocate memory in CHIP first)
  1934.  
  1935. Break [processnumber] <taskname>
  1936. Set break signals. Useful for tasks running in background or from Workbench.
  1937. Example: Break 3 New CLI
  1938.  
  1939. Hunks [processnumber] <processname>
  1940. Show location, BCPL-Pointers and length of memory blocks the process uses.
  1941. Example: Hunks RAM
  1942.  
  1943. Snoop [processnumber] <taskname>
  1944. Track memory allocation/deallocation of a task. Press break (CTRL-C) to
  1945. stop. List includes: action (alloc/free), memory requirements (CHIP/ FAST/
  1946. PUBLIC etc), memory size, memory location (start, end) and the address from
  1947. where AllocMem() was called.
  1948.  
  1949. Files
  1950. List lock, access, size and name of open files.
  1951.  
  1952. Locks
  1953. List any lock.
  1954. BUG: Trying to lock the Volume "RAM Disk" crashes the machine sometimes. If
  1955. a Volume "RAM Disk" is found it will be replaced by the devicename "RAM:"
  1956. (this has been fixed on WB 1.3). Make sure you don't have a disk labeled
  1957. "RAM Disk" or you'll never see its locks:-)
  1958.  
  1959. Currentdir
  1960. List current directory settings of all processes.
  1961.  
  1962. Devices
  1963. List name,heads,sectors,tracks,startup-buffers and handler-process of every
  1964. DOS-device.
  1965.  
  1966. Inputhandler
  1967. Display node, priority and name (if any) of the input-handlers currently in
  1968. use.
  1969.  
  1970. Capture
  1971. Show vectors controlling the reset, i.e. CoolCapture, ColdCapture and
  1972. WarmCapture pointers, KickMem allocations. Useful when searching
  1973. for Viruses, but remember that the RAD: device in 1.3 uses the KickMem
  1974. pointer to recover from a reset.
  1975.  
  1976. ClrCool
  1977. ClrCold
  1978. ClrWarm
  1979. Clear one of those pointers.
  1980.  
  1981. Lockdrive <drivename:>
  1982. Prevent DOS, Workbench and Disk-Validator from cluttering on the drive.
  1983. This command isn't very useful, but I needed it myself. Please note that
  1984. the drivename is case sensitive and has to end with a ':'.
  1985.  
  1986. Freedrive <drivename:>
  1987. Re-enable a drive.
  1988.  
  1989. Windows
  1990. List address and title of all windows.
  1991.  
  1992. Screens
  1993. List address and title of screens.
  1994.  
  1995. Fonts
  1996. List address,height,width,type,fist character and last character of all
  1997. loaded fonts.
  1998.  
  1999. Windowfonts
  2000. List Windows and associated fonts.
  2001.  
  2002. Freeze [processnumber] <taskname>
  2003. Halt a Task. The task should be READY or WAITING. Frozen tasks are queued in
  2004. a new list called FROZEN. When you leave Xoper, halted Task will be
  2005. released.
  2006. Example: Freeze Killer Graphics Task
  2007.  
  2008. Warm [processnum] <taskname>
  2009. Restart a halted Task. Task must be FROZEN.
  2010. Example: Warm Killer Graphics Task
  2011.  
  2012. Hide <taskname>
  2013. The task-list tend to be longer than the window size. You may inhibit the
  2014. output of some tasks you are not interested in using his command.
  2015. Example: Hide trackdisk.device
  2016.  
  2017. Hidden
  2018. Turn those hidden Tasks back on. It actually is a toggle.
  2019.  
  2020. Header
  2021. Toggle the (rather long) header on the task display on/off.
  2022.  
  2023. Sort
  2024. The tasks listing is sorted (on V1.3 and above) to avoid 'jumping' of the
  2025. display. Sort toggles this feature on/off. (Stupid command, but was easy
  2026. to implement).
  2027.  
  2028. Info <librarynode | devicenode>
  2029. Show additional information stored in the lib_IdString field.
  2030. Example: Info arp.library
  2031.  
  2032. Openlib <libraryname>
  2033. Open a library. This is useful if you don't want a specified library being
  2034. 'flushed' out.
  2035. Example: Openlibrary arp.library
  2036.  
  2037. Clear [longword]
  2038. Fill unused memory chunks with pattern, default is 0. Handy for debuggers.
  2039. Example: Clear $66726565
  2040.  
  2041. Flush
  2042. Clean up memory, flush unused libraries, devices and fonts.
  2043.  
  2044. Lastalert
  2045. Show last Guru Meditation code or rubbish.
  2046.  
  2047. Usage
  2048. Toggle CPUSE field on the task display between usage relative to all
  2049. possible dispatches and usage relative to actually dispatched tasks.
  2050. Ahem...not very clear I think. Well, let me try again...
  2051. If you add all CPUSE fields together you get 100 % (more or less 1%). After
  2052. entering "Usage" adding the fields together will give you the same value as
  2053. shown in the 'CPU Activity field'. (I HATE having to write docs)
  2054.  
  2055. Taskports
  2056. Disable / enable a listing of taskports if ports are displayed.
  2057.  
  2058. More
  2059. Stop displaying "<MORE>" and "<RETURN>" if output exceeds window.
  2060.  
  2061. Window <leftedge> [toptedge [width [height]]]
  2062. Works only on script files. Defines the window to be opened.
  2063. Example: Window 0 0 550 190
  2064.  
  2065. Quit or just Q
  2066. Exit Xoper. If Xoper was started with '-b' or if 'Hold' was specified it
  2067. will stay in background waiting for LeftAmiga-RightAmiga-X.
  2068.  
  2069. Hold
  2070. Exit Xoper but install a key-handler and stay in background. Window
  2071. settings and display commands are saved.
  2072.  
  2073. Exit
  2074. Clean up and quit.
  2075.  
  2076. !!!! WARNING: The next few commands are dangerous and 'dirty' !!!!!
  2077. !!!!!!!!!!!! don't use them if not strictly necessary !!!!!!!!!!!!!
  2078.  
  2079. Kill [processnumber] <taskname>
  2080. Kill a task or a process. If the task has been called from CLI, the Task
  2081. itself and the CLI will be killed. Hunks, Windows, Screens  and the
  2082. teminal-window will be freed. Simple tasks are just RemTask()'ed. If it is
  2083. not a CLI Task you'll be asked if it is a Workbench task, if the answer is
  2084. 'Yes' unloading will be done by the Workbench. If not, you will be prompted
  2085. if Xoper should unload the code. Enter 'No' if you don't know how the task
  2086. has been started.
  2087.  
  2088. Closewindow <title>
  2089. Closes a Window. Please, use it only if the corresponding Task has been
  2090. 'Cancel'ed. Use the Window-Structure address if the window has no name.
  2091.  
  2092. Closescreen <title>
  2093. same as above, but for screens.
  2094.  
  2095. Unlock <lock (BPTR)>
  2096. Unlock a file.
  2097.  
  2098. Closelib <libraryname>
  2099. This is exactly the same as CloseLibrary().
  2100.  
  2101. CD [processnumber] <processname>
  2102. Change the current directory of a process. You are prompted if the old
  2103. directory lock should be unlocked.
  2104.  
  2105. Signal <mask> [processnumber] <taskname>
  2106. Set any task-signal. Mask is a hexadecimal value with or w/o leading '$'.
  2107. See task's SIGWAIT field for sensible values. Tasks normaly do not wait for
  2108. signals only, but for messages, that's why this command may not have the
  2109. desired effect, but it is quite useful for tasks hanging around and waiting
  2110. for events that may never happen. Warning: Using Signal without any
  2111. knowledge about what you are going to signal may cause a system-crash!
  2112. Example: Signal 10000000 PopCLI III
  2113.  
  2114. ----------------------------------------------------------------------------
  2115. ;Sample Startup Script (to be placed in s:Xoper.Startup)
  2116. ;
  2117. ; Window definition on a overscanned + PAL Workbench screen
  2118. Window 122 0 550 230
  2119. ;
  2120. ;don't display some Tasks
  2121. ;
  2122. Hide CON
  2123. Hide trackdisk.device
  2124. ;
  2125. ;but turn them on on Startup
  2126. ;
  2127. Hidden
  2128. ;
  2129. ;Change the default list to Ports
  2130. ;
  2131. P
  2132. ;don't display any prompt if the window is full
  2133. More
  2134. ----------------------------------------------------------------------------
  2135. I want to thank these people for helping me to debug and enhance the current
  2136. Version of Xoper:
  2137. Jeff White, Patrik Skottsborg, Michael Beer, Christian Balzer, Lars Soltau,
  2138. Heiko Rath and Bob Page.
  2139. Thanks.
  2140. ----------------------------------------------------------------------------
  2141. Please send flames, bug reports and especially a list of features you would
  2142. like to have included in the next version to
  2143.  
  2144.  Werner Gunther
  2145.  Wingertspfad 12
  2146.  D 6900 Heidelberg
  2147.  (Germany)
  2148.  
  2149. or to my EMAIL address for a fast response:
  2150.  
  2151.  G35@DHDURZ1.BITNET
  2152.  
  2153.  
  2154. SHAR_EOF
  2155. #    End of shell archive
  2156. exit 0
  2157. -- 
  2158. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  2159. Have five nice days.
  2160.